﻿@model IEnumerable<Activity>
@{long lastActivityId = ViewData.Get<long>("lastActivityId", 0);}
@if (Model != null && Model.Count() > 0)
{
    var applicationService = new ApplicationService();
    foreach (var item in Model)
    {
        string areaName = "Common";
        if (item.ApplicationId > 0)
        {
            var application = applicationService.Get(item.ApplicationId);
            if (application == null || !application.IsEnabled)
            {
                continue;
            }
            areaName = application.ApplicationKey;
        }
        string tenantTypeIdPart = "";
        if (!string.IsNullOrEmpty(item.TenantTypeId))
        {
            tenantTypeIdPart = item.TenantTypeId;
        }
    @Html.AjaxRouteAction(string.Format("ActivityDetail_{0}_{1}", tenantTypeIdPart, item.ActivityItemKey), new { ActivityId = item.ActivityId, area = areaName })
    }
    <script type="text/javascript">
        $("#lastActivityId").val('@lastActivityId');
    </script>
}